package com.guigu.user.controller;


import cn.hutool.core.bean.BeanUtil;
import com.guigu.user.entity.Area;
import com.guigu.user.entity.vo.AreaVO;
import com.guigu.user.service.AreaService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author TaoLong
 * @since 2021-11-11
 */
@RestController
@RequestMapping("/user/area")
public class AreaController {

    @Autowired
    private AreaService areaService;

    /**
     * 获取所有的区域信息
     *
     * @return
     */
    @ApiOperation("获取所有的区域信息")
    @GetMapping("/getAllArea")
    public List<AreaVO> getAllArea() {
        List<Area> list = areaService.list(null);
        List<AreaVO> copy = BeanUtil.copyToList(list, AreaVO.class);
        return copy;
    }
}

